//package com.rxyb.auth.handler;
//
//import com.rxyb.auth.model.SecurityUser;
//import com.rxyb.core.respone.enums.CommonCode;
//import com.rxyb.toolize.IpUtils;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.http.MediaType;
//import org.springframework.security.core.Authentication;
//import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
//
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
///**
// * 登陆成功处理器
// *
// * @author duyh
// * @date 2020/5/22
// */
//@Slf4j
//public class LoginSuccessHandler implements AuthenticationSuccessHandler {
//
//    @Override
//    public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException {
//        String ipAddr = IpUtils.acquireRealIP(httpServletRequest);
//        // 获取登录成功信息
//        SecurityUser user = (SecurityUser) authentication.getPrincipal();
//
//        log.info(user.getUsername() + "  登陆成功处理器！ IP=" + ipAddr);
//
//        httpServletResponse.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
//
//
//        httpServletResponse.getWriter().write(CommonCode.SUCCESS.toString());
//    }
//}
